#!/usr/bin/env python3.3

#
#  Filename: e17.py
#  Author  : lukas singer
#
#  Comment : Created by createSolution.sh
#

#import euler
#from euler import *

def pe17():
  sum=len("onethousand")
  sum+=900*len("hundred")
  sum+=891*len("and")
  sum+=100*len("onetwothreefourfivesixseveneightnine")
  sum+=100*len("twentythirtyfortyfiftysixtyseventyeightyninety")
  sum+=80*len("onetwothreefourfivesixseveneightnine")
  sum+=10*len("onetwothreefourfivesixseveneightnineten")
  sum+=10*len("eleventwelvethirteenfourteenfifteensixteenseventeeneighteennineteen")
  print(sum)

if __name__=="__main__":
  pe17()

